//对象实例
function Object1() {
    var User={
        name:'张小凡',
        birth:1990,
        school:'No.1 Middle School',
        height:1.72,
        weight:'60Kg',
        score:null
    };
    console.log(User.name);
    console.log(User.birth);
}

function Object2() {
    var User1={
        name:'陆雪琪',
        'Middle-school':'No.1 Middle School'
    };
    console.log(User1.name);
    console.log(User1['Middle-school']);
}

function Object3() {
    //由于JavaScript的对象是动态类型，你可以自由地给一个对象添加或删除属性
    var User2={
        name:'乔峰',
    };
    User2.age;//undefined
    User2.age=32;//增加一个age属性
    console.log(User2.age);//18

    delete User2.age;//删除age属性
    delete User2.name;//删除name属性
    console.log(User2.name);
    delete User2.school;//删除不存在的属性
    console.log(User2.school);
}

//判断对象中是否存在某个元素
function Person() {
    var Man={
        name:'段誉',
        age:18,
        address:'云南大理'
    }
    //用in判断Man是否拥有某一属性
    console.log('name' in Man);//原有属性
    console.log('toString'in Man);//继承的属性
    //用hasOwnProperty,判断是否是自有属性，而不是继承来的属性
    console.log(Man.hasOwnProperty('name'));
    console.log(Man.hasOwnProperty('toString'));
}